/*
 * 创建日期 2011-3-3
 *
 * 成都天和软件公司
 * 电话：028-85425861 
 * 传真：028-85425861-8008 
 * 邮编：610041 
 * 地址：成都市武侯区航空路6号丰德万瑞中心B座1001 
 * 版权所有
 */
package  org.fantasy.common.db.pool;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.DataSource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.olap4j.OlapConnection;

/**
 * 连接池
 * 
 * @author 王文成
 * @version 1.0
 * @since 2011-3-24
 */
public class ConnectionPool {

	private static final Log log = LogFactory.getLog(ConnectionPool.class);

	/**
	 * 取得连接
	 * 
	 * @return
	 * @throws Exception
	 */
	public static OlapConnection getOlapConnection(DBOptions options) throws SQLException {
		DataSource dataSource = DataSourcePool.getDataSource(options);
		return (OlapConnection) dataSource.getConnection();
	}

	/**
	 * 取得连接
	 * 
	 * @return
	 * @throws Exception
	 */
	public static Connection getConnection(DBOptions options) throws SQLException {
		DataSource dataSource = DataSourcePool.getDataSource(options);
		return (Connection) dataSource.getConnection();
	}
}